<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wwwApp: database/postgresql.php Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">wwwApp
   </div>
   <div id="projectbrief">A web app for workshop organizing, recruitment and qualification</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_f32c53f2c0f0ccaeb11076e30674d5f4.html">database</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">postgresql.php</div>  </div>
</div><!--header-->
<div class="contents">
<a href="postgresql_8php.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;&lt;?php</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> *      database/postgresql.php</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;</div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;require_once(<span class="stringliteral">&#39;sql.php&#39;</span>);</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div>
<div class="line"><a name="l00008"></a><span class="lineno"><a class="code" href="classDB__PostgreSQL.html">    8</a></span>&#160;<span class="keyword">class </span><a class="code" href="classDB__PostgreSQL.html">DB_PostgreSQL</a> <span class="keyword">extends</span> <a class="code" href="classDB__SQL.html">DB_SQL</a></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;{</div>
<div class="line"><a name="l00010"></a><span class="lineno"><a class="code" href="classDB__PostgreSQL.html#a9c143e75ac1ba2332e3c36f5eff134ee">   10</a></span>&#160;        <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDB__PostgreSQL.html#a9c143e75ac1ba2332e3c36f5eff134ee">__construct</a>($connectionString)</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;        {</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;                <a class="code" href="classDB__PostgreSQL.html#a9c143e75ac1ba2332e3c36f5eff134ee">parent::__construct</a>($connectionString);</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;                $this-&gt;driver = <span class="stringliteral">&#39;PostgreSQL&#39;</span>;</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;                <a class="code" href="classDB.html#a75d8342d237a97b7822d691aa5a2546c">$tables</a> = $this-&gt;<a class="code" href="classDB__SQL.html#a1a580ec0eb6ad87c9993562531265314">query</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="stringliteral">                        SELECT relname</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="stringliteral">                        FROM pg_class</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="stringliteral">                        WHERE</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="stringliteral">                                relname LIKE $1 AND</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="stringliteral">                                relowner NOT IN (SELECT usesysid FROM pg_user WHERE usename=\&#39;postgres\&#39;) AND</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="stringliteral">                                relkind = \&#39;r\&#39;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="stringliteral">                        &#39;</span>,</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;                        <a class="code" href="config_8php_8template.html#a5f2257735345fb41d6dbb3f7a9036a4b">TABLE_PREFIX</a>.<span class="charliteral">&#39;%&#39;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;                );</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;                <span class="comment">//$this-&gt;tables[&#39;pg_class&#39;] = new DBTable_Postgresql($this, &#39;pg_class&#39;, array(array(&#39;name&#39;=&gt;&#39;relname&#39;,)));</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;                <span class="keywordflow">foreach</span> (<a class="code" href="classDB.html#a75d8342d237a97b7822d691aa5a2546c">$tables</a> as $table)</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;                {</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;                        $result = $this-&gt;<a class="code" href="classDB__SQL.html#a1a580ec0eb6ad87c9993562531265314">query</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="stringliteral">                                SELECT</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="stringliteral">                                        pg_attribute.attname AS name,</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="stringliteral">                                        format_type(pg_attribute.atttypid, pg_attribute.atttypmod) AS type</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="stringliteral">                                FROM pg_index, pg_class, pg_attribute</span></div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="stringliteral">                                WHERE</span></div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="stringliteral">                                        pg_class.oid = $1::regclass AND</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="stringliteral">                                        indrelid = pg_class.oid AND</span></div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="stringliteral">                                        pg_attribute.attrelid = pg_class.oid AND</span></div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="stringliteral">                                        pg_attribute.attnum = any(pg_index.indkey) AND</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="stringliteral">                                        indisprimary</span></div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="stringliteral">                                ORDER BY pg_attribute.attnum</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="stringliteral">                                &#39;</span>, $table[<span class="stringliteral">&#39;relname&#39;</span>]</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;                        );</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;                        $this-&gt;tables[$table[<span class="stringliteral">&#39;relname&#39;</span>]] =</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;                                <span class="keyword">new</span> DBTable_Postgresql($this, $table[<span class="stringliteral">&#39;relname&#39;</span>], $this-&gt;<a class="code" href="classDB.html#a24e5e9e3745e28578179ab3a6169b80c">fetch_all</a>());</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;                }</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;        }</div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="code" href="classDB__PostgreSQL.html#a35c72d161281997ab74e7d2db24e3b4e">   45</a></span>&#160;        <span class="keyword">function</span> <a class="code" href="classDB__PostgreSQL.html#a35c72d161281997ab74e7d2db24e3b4e">connect</a>($connectionString)  { <span class="keywordflow">return</span> pg_connect($connectionString); }</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;</div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="code" href="classDB__PostgreSQL.html#aca232dd63294f547b04b1da589c065ae">   47</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDB__PostgreSQL.html#aca232dd63294f547b04b1da589c065ae">last_error</a>() { <span class="keywordflow">return</span> pg_last_error(); }</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="code" href="classDB__PostgreSQL.html#a7dc613873fda5de64d0d1ec4e44bc6c8">   49</a></span>&#160;        <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDB__PostgreSQL.html#a7dc613873fda5de64d0d1ec4e44bc6c8">query_params</a>($query, $params)  { <span class="keywordflow">return</span> pg_query_params($query, $params); }</div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="code" href="classDB__PostgreSQL.html#a1381da42a9857f8a06b9c4b602b726f2">   50</a></span>&#160;        <span class="keyword">protected</span> <span class="keyword">function</span> <a class="code" href="classDB__PostgreSQL.html#a1381da42a9857f8a06b9c4b602b726f2">query_noparams</a>($query)  { <span class="keywordflow">return</span> pg_query($query); }</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;}</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="code" href="classDBTable__PostgreSQL.html">   54</a></span>&#160;<span class="keyword">class </span><a class="code" href="classDBTable__PostgreSQL.html">DBTable_PostgreSQL</a> <span class="keyword">extends</span> <a class="code" href="classDBTable__SQL.html">DBTable_SQL</a></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;{</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        <span class="comment">// Warning: may cause race when sequence frequently updated.</span></div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;        <span class="comment">// TODO - replace with nextValue</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"><a class="code" href="classDBTable__PostgreSQL.html#adc73d5d23bd0a9e8db8ebe5984ce409d">   58</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBTable__PostgreSQL.html#adc73d5d23bd0a9e8db8ebe5984ce409d">lastValue</a>($column = null)</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        {</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;                <span class="keywordflow">if</span> (is_null($column))  $column = $this-&gt;pkeyColumns[0][<span class="stringliteral">&#39;name&#39;</span>];</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;                $r = $this-&gt;<a class="code" href="classDB.html">DB</a>-&gt;query(<span class="stringliteral">&#39;SELECT currval(\&#39;&#39;</span>. $this-&gt;name .<span class="charliteral">&#39;_&#39;</span>. $column .<span class="stringliteral">&#39;_seq\&#39;)&#39;</span>);</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;                <span class="keywordflow">return</span> $r-&gt;<a class="code" href="classDB.html#ae314c1807aa636e83084e7f776df8ca5">fetch</a>();</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        }</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;}</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="code" href="classDBRow__PostgreSQL.html">   66</a></span>&#160;<span class="keyword">class </span><a class="code" href="classDBRow__PostgreSQL.html">DBRow_PostgreSQL</a> <span class="keyword">extends</span> <a class="code" href="classDBRow__SQL.html">DBRow_SQL</a></div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;{</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;}</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html">   71</a></span>&#160;<span class="keyword">class </span><a class="code" href="classDBResult__Postgresql.html">DBResult_Postgresql</a> <span class="keyword">extends</span> <a class="code" href="classDBResult__SQL.html">DBResult_SQL</a></div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;{</div>
<div class="line"><a name="l00073"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#aaad736521ef8638a7ff2aaeeafa119c8">   73</a></span>&#160;        <span class="keyword">protected</span> <a class="code" href="classDBResult__Postgresql.html#aaad736521ef8638a7ff2aaeeafa119c8">$count</a> = 0;</div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#aa7498300e33e7a65a23ca9269281bba3">   74</a></span>&#160;        <span class="keyword">protected</span> <a class="code" href="classDBResult__Postgresql.html#aa7498300e33e7a65a23ca9269281bba3">$i</a> = 0;</div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#a36c327d7317fa4d53f9af3061d6d2229">   75</a></span>&#160;        <span class="keyword">protected</span> <a class="code" href="classDBResult__Postgresql.html#a36c327d7317fa4d53f9af3061d6d2229">$value</a> = null;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#a3fbc244dac682bf3a72015348d8cb6f4">   77</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#a3fbc244dac682bf3a72015348d8cb6f4">__construct</a>(<a class="code" href="classDBResult.html#a672dee4bc8dada3fecf2b4f306ece3ef">$DB</a>, <a class="code" href="classDBResult.html#af3f8b2a7d0016fb9479da02a018b2044">$resultResource</a>)</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;        {</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;                <a class="code" href="classDBResult__Postgresql.html#a3fbc244dac682bf3a72015348d8cb6f4">parent::__construct</a>(<a class="code" href="classDBResult.html#a672dee4bc8dada3fecf2b4f306ece3ef">$DB</a>, <a class="code" href="classDBResult.html#af3f8b2a7d0016fb9479da02a018b2044">$resultResource</a>);</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;                $this-&gt;<a class="code" href="classDBResult__Postgresql.html#a0e38325eb55607dea2d44147e983111c">count</a> = $this-&gt;<a class="code" href="classDBResult__Postgresql.html#a0e38325eb55607dea2d44147e983111c">count</a>();</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;        }</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;</div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#aa2089b6d4687194e39107ca738a8fde3">   83</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#aa2089b6d4687194e39107ca738a8fde3">rewind</a>()</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;        {</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;                <span class="comment">// TODO pg_result_seek($this-&gt;resultResource, 0); and fetch_assoc()</span></div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;                <span class="comment">// instead of jumping through rows</span></div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;                $this-&gt;i = -1;</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;                $this-&gt;<a class="code" href="classDBResult__Postgresql.html#a8f06815635fcabb7c70751b4ef5a408a">next</a>();</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        }</div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#a2a99f1721b7284a5ce264a1497cc8079">   90</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#a2a99f1721b7284a5ce264a1497cc8079">valid</a>()   { <span class="keywordflow">return</span> ($this-&gt;i &lt; $this-&gt;<a class="code" href="classDBResult__Postgresql.html#a0e38325eb55607dea2d44147e983111c">count</a>); }</div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#a6b30ca0c95b4ee3a73782ad33085b932">   91</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#a6b30ca0c95b4ee3a73782ad33085b932">key</a>()     { <span class="keywordflow">return</span> <a class="code" href="classDBResult__Postgresql.html#aa7498300e33e7a65a23ca9269281bba3">$this-&gt;i</a>; }</div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#abba9dd676c95a2719e80e5610d76e3f6">   92</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#abba9dd676c95a2719e80e5610d76e3f6">current</a>() { <span class="keywordflow">return</span> <a class="code" href="classDBResult__Postgresql.html#a36c327d7317fa4d53f9af3061d6d2229">$this-&gt;value</a>; }</div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#a8f06815635fcabb7c70751b4ef5a408a">   93</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#a8f06815635fcabb7c70751b4ef5a408a">next</a>()</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;        {</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;                <span class="comment">// PostgreSQL stores result resources in a way which</span></div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;                <span class="comment">// doesn&#39;t make jumping through rows inefficient</span></div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;                <span class="comment">// (so we&#39;re not assuming we can just fetch_assoc() to get the next row by default).</span></div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;                ++<a class="code" href="classDBResult__Postgresql.html#aa7498300e33e7a65a23ca9269281bba3">$this-&gt;i</a>;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;                <span class="keywordflow">if</span> ($this-&gt;i &lt; $this-&gt;<a class="code" href="classDBResult__Postgresql.html#a0e38325eb55607dea2d44147e983111c">count</a>)</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;                        $this-&gt;value = $this-&gt;<a class="code" href="classDBResult__Postgresql.html#acef54e49c60affe0d26bf92da6be6f98">fetch_assoc</a>($this-&gt;i);</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;                <span class="keywordflow">else</span></div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;                        $this-&gt;value = null;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;        }</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;</div>
<div class="line"><a name="l00105"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#a0e38325eb55607dea2d44147e983111c">  105</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#a0e38325eb55607dea2d44147e983111c">count</a>()  { <span class="keywordflow">return</span> pg_num_rows($this-&gt;resultResource); }</div>
<div class="line"><a name="l00106"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#a6ae671abe03764929d5f665c38b8c863">  106</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#a6ae671abe03764929d5f665c38b8c863">affected_rows</a>() { <span class="keywordflow">return</span> pg_affected_rows($this-&gt;resultResource); }</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div>
<div class="line"><a name="l00108"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#acef54e49c60affe0d26bf92da6be6f98">  108</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#acef54e49c60affe0d26bf92da6be6f98">fetch_assoc</a>($n = null)</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        {</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;                <span class="keywordflow">if</span> (is_null($n))  <span class="keywordflow">return</span> pg_fetch_assoc($this-&gt;resultResource);</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;                <span class="keywordflow">else</span>  <span class="keywordflow">return</span> pg_fetch_assoc($this-&gt;resultResource, $n);</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;        }</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div>
<div class="line"><a name="l00114"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#aa2985373bca530e3f86d5d2056e02e5f">  114</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#aa2985373bca530e3f86d5d2056e02e5f">fetch_vector</a>($n = null)</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        {</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;                <span class="keywordflow">if</span> (is_null($n))  <span class="keywordflow">return</span> pg_fetch_row($this-&gt;resultResource);</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;                <span class="keywordflow">else</span>  <span class="keywordflow">return</span> pg_fetch_row($this-&gt;resultResource, $n);</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;        }</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;</div>
<div class="line"><a name="l00120"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#a19e57fb62c28116f5e89e9ef3d0242d0">  120</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#a19e57fb62c28116f5e89e9ef3d0242d0">fetch_all</a>()</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;        {</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;                $result = pg_fetch_all($this-&gt;resultResource);</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;                <span class="comment">// pg_fetch_all returns false for empty results. We should check for errors here.</span></div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;                <span class="keywordflow">if</span> (!$result)  <span class="keywordflow">return</span> array();</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;                <span class="keywordflow">return</span> $result;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;        }</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;</div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="code" href="classDBResult__Postgresql.html#aaef008467c9ebceb85ce72c80a9ce43b">  128</a></span>&#160;        <span class="keyword">public</span> <span class="keyword">function</span> <a class="code" href="classDBResult__Postgresql.html#aaef008467c9ebceb85ce72c80a9ce43b">fetch_column</a>($column = null)</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        {</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;                <span class="keywordflow">if</span> (is_null($column))</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;                        <span class="keywordflow">return</span> pg_fetch_all_columns($this-&gt;resultResource);</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;                <span class="keywordflow">else</span></div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;                        <span class="keywordflow">return</span> <a class="code" href="classDBResult__Postgresql.html#aaef008467c9ebceb85ce72c80a9ce43b">parent::fetch_column</a>($column);</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;        }</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;}</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Sep 8 2013 17:44:56 for wwwApp by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.1
</small></address>
</body>
</html>
